package com.learn.micro.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient;
import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/instance")
public class InstanceController {
	
	@Autowired
	CompositeDiscoveryClient discoveryClient;
	
	@Autowired
	EurekaRegistration eurekaRegistration;

	@RequestMapping("/info")
	public ResponseEntity<String> getInstanceInfo() {
		return ResponseEntity.ok(eurekaRegistration.getServiceId());
	}

}
